@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

@tailwind base;
@tailwind components;
@tailwind utilities;

:root {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  line-height: 1.5;
  font-weight: 400;
  color-scheme: dark;
  
  /* 主题变量 - 专业科技蓝 */
  --bg-primary: #0a0d12;
  --bg-secondary: #1a1d24;
  --text-primary: #ffffff;
  --text-secondary: #9ca3af;
  --border-color: rgba(255, 255, 255, 0.1);
  --surface-color: rgba(255, 255, 255, 0.05);
  --primary-color: #3b82f6;
  --primary-dark: #1e40af;
  --primary-light: #60a5fa;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  
  background-color: var(--bg-primary);
}

* {
  box-sizing: border-box;
  /* 移动端优化：防止长按选择文本 */
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
  
  /* 移动端优化：防止过度滚动（橡皮筋效果） */
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
  
  /* 移动端优化：字体平滑 */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  
  /* 移动端优化：禁用文本大小自动调整 */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* 浅色主题 */
body.light-theme {
  color-scheme: light;
}

body.light-theme .glass-effect-dark {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(20px);
  border-color: rgba(0, 0, 0, 0.1);
}

body.light-theme .text-white {
  color: #1a1a1a !important;
}

body.light-theme .text-gray-300,
body.light-theme .text-gray-400 {
  color: #6b7280 !important;
}

#root {
  min-height: 100vh;
}

/* 深色主题自定义滚动条 */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(15, 20, 25, 0.5);
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #3b82f6 0%, #1e40af 100%);
  border-radius: 10px;
  border: 2px solid rgba(15, 20, 25, 0.5);
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #60a5fa 0%, #3b82f6 100%);
}

/* 玻璃态效果 */
.glass-effect {
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.glass-effect-dark {
  background: rgba(10, 13, 18, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* 网格背景动画 */
.animated-grid-bg {
  background-image: 
    linear-gradient(rgba(59, 130, 246, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  animation: grid-move 20s linear infinite;
}

@keyframes grid-move {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 50px 50px;
  }
}

/* 渐变文字效果 */
.gradient-text {
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 50%, #2563eb 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* 发光边框效果 */
.glow-border {
  position: relative;
  border: 1px solid transparent;
  background: linear-gradient(#0a0d12, #0a0d12) padding-box,
              linear-gradient(135deg, #3b82f6, #1e40af) border-box;
  border-radius: 16px;
}

.glow-border::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 16px;
  padding: 2px;
  background: linear-gradient(135deg, #60a5fa, #3b82f6, #2563eb);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.5;
  transition: opacity 0.3s;
}

.glow-border:hover::before {
  opacity: 1;
}

/* 脉冲光环效果 */
@keyframes pulse-ring {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 30px rgba(59, 130, 246, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
  }
}

.pulse-ring {
  animation: pulse-ring 2s cubic-bezier(0.455, 0.03, 0.515, 0.955) infinite;
}

/* 加载动画 */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-spinner {
  animation: spin 1s linear infinite;
}

/* 浮动粒子效果 */
.particle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.3;
  animation: float-particle 15s infinite ease-in-out;
}

@keyframes float-particle {
  0%, 100% {
    transform: translate(0, 0) scale(1);
    opacity: 0.3;
  }
  25% {
    transform: translate(100px, -100px) scale(1.2);
    opacity: 0.6;
  }
  50% {
    transform: translate(200px, 0) scale(0.8);
    opacity: 0.3;
  }
  75% {
    transform: translate(100px, 100px) scale(1.1);
    opacity: 0.5;
  }
}

/* 按钮悬停效果 */
.btn-glow {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.btn-glow::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-glow:hover::before {
  width: 300px;
  height: 300px;
}

/* 卡片悬停效果 */
.card-hover {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 40px rgba(102, 126, 234, 0.3);
}

/* 新增动画 */
@keyframes slideDown {
  0% {
    transform: translateY(-20px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes scaleIn {
  0% {
    transform: scale(0.95);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.animate-slide-down {
  animation: slideDown 0.4s ease-out;
}

.animate-scale-in {
  animation: scaleIn 0.3s ease-out;
}

/* 拖拽区域增强效果 */
.drag-active {
  background: radial-gradient(circle at center, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
  animation: pulse 1s ease-in-out infinite;
}

/* 微光扫过效果 */
@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

.shimmer {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.05) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  background-size: 1000px 100%;
  animation: shimmer 3s infinite;
}

/* 移动端优化 */

/* 触摸友好的按钮最小尺寸 */
@media (max-width: 768px) {
  button, a, input[type="button"], input[type="submit"] {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* 减少移动端动画以提升性能 */
  .particle {
    display: none;
  }
  
  /* 简化移动端背景动画 */
  .animated-grid-bg {
    animation: none;
    opacity: 0.2;
  }
  
  /* 移动端输入框优化 */
  input, textarea, select {
    font-size: 16px !important; /* 防止 iOS Safari 自动缩放 */
  }
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
  /* 移除 hover 效果，使用 active 状态 */
  .card-hover:hover {
    transform: none;
  }
  
  .card-hover:active {
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.2);
  }
  
  /* 按钮触摸反馈 */
  button:active {
    transform: scale(0.98);
    opacity: 0.9;
  }
}

/* 虚拟键盘处理 */
@media (max-width: 768px) {
  /* 当虚拟键盘弹出时，固定定位的元素需要调整 */
  .fixed-on-mobile {
    position: absolute;
  }
  
  /* 防止视口缩放导致的布局问题 */
  input:focus,
  textarea:focus,
  select:focus {
    /* 防止 iOS 自动缩放 */
    font-size: 16px;
  }
}

/* 横屏模式优化 */
@media (max-width: 768px) and (orientation: landscape) {
  /* 横屏时减小垂直间距 */
  .pt-24, .pt-32 {
    padding-top: 1rem !important;
  }
  
  .pb-12, .pb-16 {
    padding-bottom: 0.5rem !important;
  }
}

/* 性能优化：减少重绘 */
.will-change-transform {
  will-change: transform;
}

.will-change-opacity {
  will-change: opacity;
}

/* 平滑滚动 */
html {
  scroll-behavior: smooth;
}

/* 触摸滚动优化 */
.scroll-smooth {
  -webkit-overflow-scrolling: touch;
  overflow-scrolling: touch;
}

/* 防止移动端图片拖拽 */
img {
  -webkit-user-drag: none;
  user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
}

/* Canvas 元素触摸优化 */
canvas {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

/* 移动端模态框优化 */
@media (max-width: 768px) {
  .modal-content {
    max-height: 90vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* 加载状态优化 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==================== 3D平台增强样式 ==================== */

/* 科技蓝主题色 - 与HTML示例一致 */
:root {
  --tech-blue: rgba(56, 139, 253, 1);
  --tech-blue-light: rgba(74, 158, 255, 1);
  --tech-cyan: rgba(56, 189, 248, 1);
  --base-100: rgba(23, 23, 23, 1);
  --base-200: rgba(30, 30, 30, 1);
  --base-300: rgba(41, 41, 41, 1);
}

/* 技术感边框 */
.tech-border {
  border: 1px solid rgba(56, 139, 253, 0.3);
}

/* 技术渐变背景 */
.tech-gradient {
  background: linear-gradient(135deg, var(--tech-blue), var(--tech-cyan));
}

/* 增强的玻璃态效果 */
.glass-effect-enhanced {
  background: rgba(30, 30, 30, 0.8);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(56, 139, 253, 0.2);
}

/* 阴影层级系统 */
.elevation-1 {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.elevation-2 {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}

.elevation-3 {
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}

/* 文字发光效果 */
.text-glow {
  text-shadow: 0 0 8px rgba(56, 139, 253, 0.5);
}

/* 导航悬停效果 */
.nav-hover {
  transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out, transform 0.15s ease-in-out;
}

.nav-hover:hover {
  transform: translateY(-1px);
}

/* 平滑过渡 */
.transition-all-smooth {
  transition: all 0.2s ease-out;
}

/* 聚焦样式 */
.focus-primary:focus {
  outline: 2px solid var(--tech-blue);
  outline-offset: 2px;
}

/* 自定义滚动条（深色主题） */
.custom-scrollbar::-webkit-scrollbar {
  width: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: var(--base-200);
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: var(--tech-blue);
  border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: var(--tech-blue-light);
}

/* 按钮悬停效果 */
.btn-tech {
  background: linear-gradient(135deg, var(--tech-blue), var(--tech-blue-light));
  border: none;
  color: white;
  transition: all 0.2s ease-out;
}

.btn-tech:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(56, 139, 253, 0.4);
}

/* 上传区域扫光效果 */
@keyframes scan-light {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}

.upload-zone-enhanced {
  position: relative;
  overflow: hidden;
}

.upload-zone-enhanced::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(56, 139, 253, 0.2), transparent);
  transition: left 0.6s ease-in-out;
}

.upload-zone-enhanced:hover::before {
  left: 100%;
}

/* 材质项悬停效果 */
.material-item {
  transition: all 0.2s ease-out;
  position: relative;
  overflow: hidden;
}

.material-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--tech-blue), transparent);
  transition: left 0.3s ease-in-out;
}

.material-item:hover::before {
  left: 100%;
}

/* 面包屑美化 */
.breadcrumbs-tech a {
  color: var(--tech-blue);
  transition: all 0.15s ease-in-out;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
}

.breadcrumbs-tech a:hover {
  color: var(--tech-blue-light);
  background-color: var(--base-200);
  transform: translateY(-1px);
}

/* 增强的卡片悬停效果 */
.card-hover-enhanced {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover-enhanced:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(56, 139, 253, 0.2);
}

/* 进度条样式 */
.progress-tech::-webkit-progress-bar {
  background-color: rgba(56, 139, 253, 0.1);
}

.progress-tech::-webkit-progress-value {
  background: linear-gradient(90deg, var(--tech-blue), var(--tech-cyan));
  transition: width 0.3s ease-in-out;
}

.progress-tech::-moz-progress-bar {
  background: linear-gradient(90deg, var(--tech-blue), var(--tech-cyan));
  transition: width 0.3s ease-in-out;
}

/* Range slider enhanced styling */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: rgba(64, 64, 64, 1);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(56, 139, 253, 1), rgba(56, 189, 248, 1));
  cursor: pointer;
  box-shadow: 0 0 8px rgba(56, 139, 253, 0.5);
  transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 12px rgba(56, 139, 253, 0.8);
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(56, 139, 253, 1), rgba(56, 189, 248, 1));
  cursor: pointer;
  border: none;
  box-shadow: 0 0 8px rgba(56, 139, 253, 0.5);
  transition: all 0.2s ease;
}

input[type="range"]::-moz-range-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 12px rgba(56, 139, 253, 0.8);
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  background: rgba(64, 64, 64, 1);
  border-radius: 2px;
}

input[type="range"]::-moz-range-track {
  height: 4px;
  background: rgba(64, 64, 64, 1);
  border-radius: 2px;
}

/* Color picker enhanced styling */
input[type="color"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: transparent;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
  border-radius: 8px;
}

input[type="color"]::-webkit-color-swatch {
  border: 2px solid rgba(56, 139, 253, 0.3);
  border-radius: 6px;
}

input[type="color"]::-moz-color-swatch {
  border: 2px solid rgba(56, 139, 253, 0.3);
  border-radius: 6px;
}

input[type="color"]:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(56, 139, 253, 0.3);
}

/* Material item scan animation */
.material-item {
  position: relative;
  overflow: hidden;
}

.material-item::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(56, 139, 253, 0.2), transparent);
  transition: left 0.5s ease-in-out;
  z-index: 1;
  pointer-events: none;
}

.material-item:hover::before {
  left: 100%;
}

/* Elevation system */
.elevation-1 {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.elevation-2 {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
}


/* 增强动画效果 */
@keyframes slide-down {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slide-in-left {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 30px rgba(168, 85, 247, 0.5), 0 0 60px rgba(59, 130, 246, 0.3);
  }
  50% {
    box-shadow: 0 0 50px rgba(168, 85, 247, 0.8), 0 0 100px rgba(59, 130, 246, 0.5);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.animate-pulse-glow {
  animation: pulse-glow 2s ease-in-out infinite;
}

.animate-fade-in {
  animation: fade-in 0.5s ease-out;
}

.animate-slide-in-left {
  animation: slide-in-left 0.4s ease-out;
}

/* 侧边栏响应式优化 */
@media (max-width: 1024px) {
  .sidebar-mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 39;
    animation: fade-in 0.2s ease-out;
  }
}

/* 用户状态指示器 */
.user-status-online::before {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  background: #10b981;
  border: 2px solid rgba(23, 23, 23, 1);
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1);
  }
}
